package com.luoxiang.socialandroid.adapter

import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.widget.TextView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.luoxiang.socialandroid.R
import com.luoxiang.socialandroid.bean.Lable1

class GrbqAdapter(data: MutableList<Lable1>) :
    BaseQuickAdapter<Lable1, BaseViewHolder>(R.layout.item_gerenbiaoqian, data) {
    override fun convert(holder: BaseViewHolder, item: Lable1) {

        holder.apply {
            val drawable = GradientDrawable()
            if(!item.color.isNullOrBlank()){
                drawable.setStroke(1, Color.parseColor(item.color));
                getView<TextView>(R.id.tv_wenroutitie).setTextColor(Color.parseColor(item.color))
            }
            drawable.cornerRadius = 50F
            drawable.setColor(Color.parseColor("#FFFFFF"));
            setText(R.id.tv_wenroutitie, item.name)
            getView<TextView>(R.id.tv_wenroutitie).background = drawable
        }

    }
}